package bb.lanxing.calc.manager;

import com.github.mikephil.charting.utils.Utils;

class SourceDataItem {
    private double sum = Utils.DOUBLE_EPSILON;
    private int count = 0;


    public void init(double sum, int count) {
        this.sum = sum;
        this.count = count;
    }

    public void add(double val) {
        this.sum += val;
        this.count++;
    }

    public double getAvg() {
        return this.sum / this.count;
    }

    public String toString() {
        return "Source data item: sum=" + ((int) this.sum) + ", count=" + this.count;
    }
}
